package com.cheegu.common.parser.gpsdata.util;

import java.io.FileNotFoundException;
import java.net.URL;

public abstract class PathUtil {

    public static String getAbsolutePath(String path) throws FileNotFoundException {
        String tmp = path.trim();
        String prefix = "classpath:";
        if (tmp.startsWith(prefix)) {
            URL resource = PathUtil.class.getClassLoader().getResource(path.substring(prefix.length(), tmp.length()));
            if(resource == null){
                throw new FileNotFoundException();
            }
            tmp = resource.getPath();
        }
        return tmp;
    }

}
